Repository navigation
media: venus: wait for the first source change in G_FMT(CAPTURE) - #52
Merged
Merged
Conversation
FFmpeg's v4l2m2m decoders queue the stream, start OUTPUT and ask for the CAPTURE format before the source change event. With the event subscribed, Venus answers -EINVAL until the firmware has parsed the headers, about 2 ms later. FFmpeg takes that as fatal for its capture setup and drops the packet it holds, then the next one, until the format is known: in one run 36 of 60 packets never reached the decoder, so every later frame referenced pictures it never got, and when the window lasted to the end of the file nothing came out at all. GStreamer waits for the event and is not affected. While OUTPUT streams with buffers handed to the firmware, wait up to 1 s for the first source change, as iris does at CAPTURE STREAMON, and answer with the parsed format. Without a stream the error stays. On the PICO 4, FFmpeg's hevc_v4l2m2m (with and without B-frames), h264_v4l2m2m and vp8_v4l2m2m decode 60 frames of 1080p60 and vp9_v4l2m2m 60 frames of 720p30, every frame equal to software decoding in five runs each, where before one of fifteen runs did.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For overpressure/phoenix#29.
FFmpeg's v4l2m2m decoders ask for the capture format before the source change event. Venus answered
-EINVALuntil the firmware had read the headers, and FFmpeg dropped a packet on every failed attempt, so most runs decoded a stream with holes or nothing at all (FFmpeg's trac #8774). While the stream is queued, Venus now waits for the firmware's first source change before it answers, like iris does at capture STREAMON. In practice that's about 0.5 ms.Tested on the headset, on 7.2-5 with this commit on top:
hevc_v4l2m2m(with and without B-frames),h264_v4l2m2m,vp8_v4l2m2mandvp9_v4l2m2m: every frame equal to software decoding in 25 of 25 runs, where 7.2-5 got 1 of 15 right. GStreamer'sv4l2h265decis unchanged, 2 of 2.dev checkpasses.